class Test1 {
    public int age = 19;
    public String name = "zhangsan";

    @Override
    public String toString() {
        return "Test1{" +
                "age=" + age +
                ", name='" + name + '\'' +
                '}';
    }

    public void show() {
        System.out.println("姓名：" + name + "年龄：" + age);
    }

}

public class Person1 {
    public static void main(String[] args) {
        Test1 test1 = new Test1();
        test1.show();
    }

    public static void main1(String[] args) {
        Test1 test1 = new Test1();
        System.out.println(test1.age);
        System.out.println(test1.name);

        //匿名对象只能使用一次，所以每次使用都要重新new一下
        System.out.println(new Test1().age);
        System.out.println(new Test1().name);

        new Test1() {
            //匿名内部类
        };
    }
}
